package com.wiscamp.ninechapters.problems.infrastructure.converters;

import com.wiscamp.ninechapters.problems.domain.models.tasks.Assignment;
import com.wiscamp.ninechapters.problems.domain.models.tasks.AssignmentDetail;
import com.wiscamp.ninechapters.problems.infrastructure.po.tasks.AssignmentDetailPO;
import com.wiscamp.ninechapters.problems.infrastructure.po.tasks.AssignmentPO;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

@Mapper(componentModel = "spring",
        unmappedTargetPolicy = ReportingPolicy.IGNORE,
        unmappedSourcePolicy = ReportingPolicy.IGNORE,
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface AssignmentConverter {
    AssignmentConverter Instance = Mappers.getMapper(AssignmentConverter.class);

    // region assignment
    AssignmentPO toAssignmentPO(Assignment entity);

    AssignmentPO toAssignmentPO(Assignment entity, @MappingTarget AssignmentPO po);

    Assignment toAssignment(AssignmentPO po);
    // endregion


    // region assignment detail
    AssignmentDetailPO toAssignmentDetailPO(AssignmentDetail entity);

    AssignmentDetailPO toAssignmentDetailPO(AssignmentDetail entity, @MappingTarget AssignmentDetailPO po);

    AssignmentDetail toAssignmentDetail(AssignmentDetailPO po);
    // endregion
}
